package com.jay.relationships.callback;

import java.util.ArrayList;
import java.util.List;

public class HealthRecord implements HealthLevelHandler{
    private List<HealthTask> tasks = new ArrayList<>();

    @Override
    public Integer getHealthLevel(){
        //根据健康任务数量来判断健康等级
        //任务越多说明越不健康，健康登记就越低
        if(tasks.size() > 5){
            return 1;
        }
        if(tasks.size() < 2){
            return 3;
        }
        return 2;
    }

    public void addTask(String taskName,Integer initialHealPoint){
        HealthTask task = new HealthTask(this, taskName, initialHealPoint);
        tasks.add(task);
    }

    public List<HealthTask> getTasks(){
        return tasks;
    }
}
